import React, { Component } from 'react'
import { Modal, Button } from 'antd';
import 'antd/dist/antd.css'

class JingXi extends Component {

    state = {
        isModalVisible: false
    }

    showModal(flag) {
        this.setState({
            isModalVisible: flag
        })
    }

    handleOk(flag) {
        this.setState({
            isModalVisible: flag
        })
    }

    handleCancel(flag) {
        this.setState({
            isModalVisible: flag
        })
    }

    render() {
        let { isModalVisible } = this.state
        return (
            <div>
                <Button type="primary" onClick={this.showModal.bind(this, true)}>
                    Open Modal
                </Button>
                <Modal title="Basic Modal" visible={isModalVisible} onOk={this.handleOk.bind(this, false)} onCancel={this.handleCancel.bind(this, false)}>
                    <p>Some contents...</p>
                    <p>Some contents...</p>
                    <p>Some contents...</p>
                </Modal>
            </div>
        )
    }
}

export default JingXi